// 分片数据上传
import {toRefs} from 'vue'
import {upload} from '../utils/request'
import {createRequest} from '../utils/concurrency'
const request = createRequest()
export default function fileUpload(burstObjRef){
    console.log('fileUpload',burstObjRef)
    
    burstObjRef.value.burst.forEach(burst => {
        let {blob, hash, i} = burst
        const form = new FormData()
        form.append('blob', blob)
        form.append('fileId', hash)
        form.append('index', i)
        request(function(){
            // await Math.floor(Math.random() * 101)//
            upload('/burst', {form}, press => {
                burst.press = press 
            })
        })
    });

    return {}
}